package com.healthdata.controller;

import com.healthdata.service.OutpatientMedicalCostService;
import com.healthdata.vo.OutpatientMedicalCostVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/api/outpatient-medical-cost")
public class OutpatientMedicalCostController {

    @Autowired
    private OutpatientMedicalCostService outpatientMedicalCostService;

    /**
     * 按年份查询门诊医疗费用（Query参数方式）
     * @param year 查询年份（例如：?year=2023）
     * @return 费用数据列表
     */
    @GetMapping("/list-by-year")
    public List<OutpatientMedicalCostVO> listByYear(
            @RequestParam(name = "year", required = true) Integer year) {
        return outpatientMedicalCostService.listByYear(year);
    }

    /**
     * 按医院等级查询门诊医疗费用（Query参数方式）
     * @param level 医院等级（例如：?level=三级）
     * @return 费用数据列表
     */
    @GetMapping("/list-by-level")
    public List<OutpatientMedicalCostVO> listByLevel(
            @RequestParam(name = "level", required = true) String level) {
        return outpatientMedicalCostService.listByLevel(level);
    }
}